The invention relates to a method and apparatus for sorting and transmitting a data packet, and more particularly, to a method and apparatus for sorting and transmitting a data packet in a local area network.
This application has been filed in the R.O.C. (Taiwan) as Patent Application No. 87100995 on 1998.
A local area network (LAN) having advantages of source sharing, data sharing and data switching, can be implemented via appropriately connecting the computers and communication equipment in a company, is widely used by many enterprises. A HUB is a frequently used constituent part for constructing a LAN. Referring to FIG. 1, it illustrates the functional block of a conventional HUB utilizing Carrier Sense with Multiple Access/Collision Detection (CSMAICD) technology, wherein n terminal equipment such as computers are connected to the same cable via n ports (11, 12 . . . 1n). CSMA/CD utilizes a xe2x80x9clisten before talkxe2x80x9d algorithm in which each terminal equipment will detect whether the shared cable is transmitting data before transmitting a frame signal. If there is no transmission on the shared cable, the signal to be transmitted is then transmitted. Two terminal equipment may simultaneously determine that there is no transmission on the shared cable and thus both start to transmit their frames simultaneously. A collision is then occurred once the frame signals are simultaneously transmitted to the shared cable. When a collision is occurred, the transmitted data is deemed as collided data and will be neglected. The terminal equipment wishing to transmit data have to wait for a period of time (3xcx9c5 seconds) to transmit the data again. Therefore, the more the terminal equipment, the more the collisions and the worse the network efficiency. To improve such a disadvantage, a switch utilizing switching technology for transmitting data is used to connect a network. The switching technology of the switch provides simultaneous data transmission between/among at least two pairs of ports in the same network, and thus the network efficiency is significantly improved.
Referring to FIG. 2, it illustrates the structure of a LAN having a switch fabric, wherein a network is formed by connecting unicast output channels 40a, 40b, 40c and 40d and unicast input channels 41a,41b,41c and 41d of four port controllers 20, 21, 22 and 23 to a switch fabric 24. The port controllers 20, 21, 22 and 23 each comprises a plurality of ports (20a, 20b, . . . 20n, 21a, 21b, . . . 21n, 22a, 22b, . . . 22n, and 23a, 23b, . . . 23n) for connecting a plurality of terminal equipment. Besides, the port controllers 20, 21, 22 and 23 are connected to the switch fabric 24 via an intercom channel 25.
Referring to FIG. 3, it illustrates the functional block of the port controller 21. A terminal equipment is connected to the port controller 21 via port 21n, wherein a medium access controller (MAC) 211 receives and decodes the data packet transmitted from the terminal equipment. The data packet format is as follows:
wherein the DA and SA are each the network card identifier, which is embedded in the network card with a length of 48 bits during manufacture, of the destination and source terminal equipment. The data packet is decoded by the MAC 211, then the DA and SA are transmitted to a router 212, and the DA, SA and the data to be transmitted (Data) are transmitted to a data queue 213 for storing. The router 212 compares the DA with the addresses stored in the address table 214. If the corresponding address of the DA of the Data can be located in the address table 214, a port number corresponded to the address can be got and is used to be the destination port. The router 212 transmits the Data stored in the queue 213 and the corresponding address (MAC address and the port number) from channel 40b to the switch fabric 24. The switch fabric 24 decodes the destination port number to get a destination channel (41a, 41c or 41d) and then transmits the Data from the destination channel to the specific port of the specific port controller. If the Data is a broadcast frame, the router 212 will broadcast the broadcast frame to every terminal equipment in the LAN via the intercom channel 25. If the DA to be located can not be located in the address table, the router 212 will deem the Data as a broadcast frame and transmit the Data to every port controller. The comparing and recording operation of the SA relate to a learning process. That is to say, the source is deemed as a new coming source when the corresponding address of the SA can not be located in the address table 214. The recorded reference list in the address table 214 itself should be refreshed, thereby recording the corresponding port of the source address. Besides, the source address of the address table of the destination port will also be refreshed when the Data is transmitted to the destination port such that the source address and the source port number of every Data can be recorded in the address table of every port controller. Therefore, the source address and source port number of the Data. can be learned only by the port controller that the Data passes. If the Data is transmitted to one of the port controllers in a unicast manner, then the source address and source port number of the Data can be learned only by the port controller that receives the Data. The other port controllers that do not receive the Data can not learn (or record) the source address and source port number of the Data. Therefore, in the prior art, the Data from the source address that can not be located in the address table will be broadcasted by the port controller. However, when a lot of terminal equipment are equipped in the LAN and the broadcast frame is frequently used, the network speed will be significantly reduced. Therefore, it is the main object of the invention to improve the drawbacks of the prior art.
In view of the disadvantages of the prior art, it is an object of the present invention to provide a method and apparatus for sorting and transmitting a data packet which is applied to a LAN. The LAN is formed by connecting a switch fabric and a plurality of port controllers. Each of the port controllers comprises a plurality of ports for connecting a plurality of terminal equipment. The port controllers are connected to the switch fabric via an intercom channel. Each of the port controllers comprises an address table for storing a reference list consisting of the port numbers of the port controllers connected to the terminal equipment and the network card addresses (identifiers) of the terminal equipment. A data packet to be transmitted from a first terminal equipment to a second terminal equipment comprises a destination address represented the network card identifier of the second terminal equipment, a source address represented the network card identifier of the first terminal equipment and data to be transmitted. The method comprises the steps of: (a) searching and comparing the source address of the data packet with the reference list stored in the address table of the port controller connected to the first terminal equipment; (b) refreshing the content of the reference list by adding. the source address representing the network card identifier of the first terminal equipment and the port number of the port controller connected to the first terminal equipment when the source address of the data packet can not be located in the address table; and (c) transmitting a new address learning frame, formed by assembling the source address representing the network card identifier of the first terminal equipment and the port number of the port controller connected to the first terminal equipment, via an intercom channel to the address tables of other port controllers for refreshing the contents of the reference lists.
According to the method for sorting and transmitting a data packet of the invention, the transmission priority of the new address learning frame is higher than that of the data to be transmitted.